package com.microsoft.socialphoto.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.microsoft.socialphoto.R;
import com.microsoft.socialphoto.adapter.item.CommentItem;

public class CommentAdapter extends ArrayAdapter<CommentItem> {

	private LayoutInflater inflater;

	public CommentAdapter(Context context, int textViewResourceId,
			ArrayList<CommentItem> objects) {
		super(context, textViewResourceId, objects);
		inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		final CommentItem item = (CommentItem) getItem(position);

		if (convertView == null)
			convertView = inflater.inflate(R.layout.comment_item, null);

		((TextView) convertView.findViewById(R.id.content)).setText(item
				.getContent());

		return convertView;
	}

}
